const { createApp } = Vue;
const app = createApp({
    beforeCreate() {
        let code = getQueryObject(window.location.href, 'code');
        let ACCESSTOKEN = getQueryObject(window.location.href, 'ACCESSTOKEN');
        if (code) {
            $.ajax({
                headers: requestHeaders(),
                url: `${mh}/requestForward/requestForward?RequestURL=${encodeURIComponent(`/wx/mp/Authorization_Service?Data=${code}`)}`,
                method: "GET",
                success: (res) => {
                    if (res.code == 200) {
                        wx.miniProgram.navigateBack();
                    }
                },
                complete: (XMLHttpRequest) => {
                    if (XMLHttpRequest.status == 302) {
                        wx.miniProgram.navigateTo({
                            url: miniProgram,
                        })
                    }
                },
            });
        } else {
            window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxb810ded32370f3d5&redirect_uri=${encodeURIComponent(`${h5}oauth2/redirect.html?ACCESSTOKEN=${ACCESSTOKEN}`)}&response_type=code&scope=snsapi_userinfo&state=123&connect_redirect=1#wechat_redirect`;
        }
    },
});
//这种方式是引入全部图标，无需单个引入
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component);
}
const ElMessage = ElementPlus.ElMessage;
app.use(ElementPlus, { locale: zhCn });
app.mount("#app");